<extend name="_layout/main" />
<block name="head">
    <style>
        .bootbox-body img {
            max-width: 100%!important;
        }
    </style>

</block>
<block name="content">
    <div class="page-content">
        <div class="page-breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="{:U('dashboard/index')}">系统首页</a>
                </li>
                <li>
                    <a href="javascript:;">分类信息管理</a>
                </li>
                <li class="active">分类信息列表</li>
            </ul>
        </div>

        <div class="page-body">

            <div class="row">

                <div class="col-xs-12 col-md-12">
                    <div class="text-align-right margin-bottom-10">
                        <a href="{:U('slider/add')}" class="btn btn-danger ajax-load"><i class="fa fa-plus"></i>添加幻灯片</a>
                    </div>
                    <form method="post" id="listForm">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th class="text-center">ID</th>
                                <th>名称</th>
                                <th>调用名</th>
                                <th>图片数</th>
                                <th class="text-center" width="300">操作</th>
                            </tr>
                            </thead>
                            <volist name="result" id="val">
                                <tr>

                                    <td class="text-center">{$val.id}</td>
                                    <td>{$val.name}</td>
                                    <td>{$val.code}</td>
                                    <td>{$val.total}</td>
                                    <td class="text-center">
                                        <a href="{:U('slider/item',['slider_id'=>$val['id']])}" class="btn btn-default btn-xs back"><i class="fa  fa-picture-o"></i>图片列表</a>
                                        <a href="{:U('slider/edit',['id'=>$val['id']])}" class="btn btn-default btn-xs back ajax-load"><i class="fa  fa-edit"></i>编辑</a>
                                        <a href="{:U('slider/delete',['id'=>$val['id']])}" class="btn btn-danger btn-xs white" data-confirm="确定删除该幻灯片?"><i class="fa fa-trash-o"></i>删除</a>
                                    </td>

                                </tr>
                            </volist>
                            <tbody>
                            </tbody>
                        </table>
                        <div class="row DTTTFooter">
                            <div class="col-sm-6">
                                <div class="dataTables_info" id="simpledatatable_info" role="status" aria-live="polite">

                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
                                    {$page}
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
    <script src="/Public/assets/js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        function checkCount() {
            return $(".select-item:checked").length;
        }
        $("#delete").click(function() {
            var action = $(this).data("action");
            if(!action) return false;
            if (!checkCount()) {
                tips('请选择要操作的数据', 'danger');
                return false;
            }
            var confirmText = $(this).data("confirmtext");
            if(confirmText){
                bootbox.confirm(confirmText,function(flag){
                    if(flag){
                        $("#listForm").attr("action",action).ajaxSubmit(function(result) {
                            result = JSON.parse(result);
                            if (result.status == 'success') {
                                location.reload();
                            } else {
                                tips(result.message, 'danger');
                            }
                        });
                    }
                })
            }else{
                $("#listForm").attr("action",action).ajaxSubmit(function(result) {
                    result = JSON.parse(result);
                    if (result.status == 'success') {
                        location.reload();
                    } else {
                        tips(result.message, 'danger');
                    }
                });
            }
        });
    </script>
</block>